package com.smartalarmclock.Model;

import android.content.Context;
import android.media.Ringtone;

import com.smartalarmclock.Model.Exceptions.RingtoneDoesNotExistException;

public interface IAlarmClock extends IDataEntity, IReferencedDataEntity, IReferencingDataEntity {

	// Enums
	
	public enum ShutOffMethod {
		Snooze (1),
		MathEquation (2),
		SentenceTyping (3);
		
		private int m_Value;
		private ShutOffMethod(int value) {
			m_Value = value;
		}
		
		public int GetValue() {
			return m_Value;
		}
		
		public static ShutOffMethod FromValue(int value) {
			if (value == ShutOffMethod.Snooze.GetValue()) {
				return ShutOffMethod.Snooze;
			}
			
			if (value == ShutOffMethod.MathEquation.GetValue()) {
				return ShutOffMethod.MathEquation;
			}
			
			if (value == ShutOffMethod.SentenceTyping.GetValue()) {
				return ShutOffMethod.SentenceTyping;
			}
			
			return null;
		}
	}
	
	public enum Settings {
		Active (1),
		Ring (2),
		Vibrate (4);
		
		private int m_Value;
		private Settings(int value) {
			m_Value = value;
		}
		
		public int GetValue() {
			return m_Value;
		}
	}
	
	/**
	 * @return true if the alarm clock is active, otherwise false
	 */
	public boolean IsActive();
	
	/**
	 * Sets the active status of the alarm clock
	 * @param isActive the new active status of the alarm clock
	 */
	public void SetActiveStatus(boolean isActive);
	
	/**
	 * @return true if the alarm clock should ring, otherwise false
	 */
	public boolean IsRinging();
	
	/**
	 * Sets the ring status of the alarm clock
	 * @param isRinging the new ring status of the alarm clock
	 */
	public void SetRingStatus(boolean isRinging);
	
	/**
	 * @return true if the alarm clock should vibrate, otherwise false
	 */
	public boolean IsVibrating();
	
	/**
	 * Sets the vibrate status of the alarm clock
	 * @param isVibrating the new vibrate status of the alarm clock
	 */
	public void SetVibrateStatus(boolean isVibrating);
	
	/**
	 * @return the shut off method of the alarm clock
	 */
	public ShutOffMethod GetShutOffMethod();
	
	/**
	 * Sets the shut off method of the alarm clock
	 * @param method the new shut off method of the alarm clock
	 */
	public void SetShutOffMethod(ShutOffMethod method);
	
	/**
	 * @return the ringtone id of the alarm clock
	 */
	public int GetRingtoneId();
	
	/**
	 * @param context the context of the request (the originating Activity)
	 * @return the a Ringtone instance matching the ringtone id of the alarm clock
	 * @throws RingtoneDoesNotExistException if the ringtone was not found in the phone database
	 */
	public Ringtone GetRingtone(Context context) throws RingtoneDoesNotExistException;
	
	/**
	 * Sets the ringtone of the alarm clock
	 * @param context the context of the request (the originating Activity)
	 * @param ringtoneTitle the title of the new ringtone as it is saved in the phone database
	 * @throws RingtoneDoesNotExistException if the ringtone was not found in the phone database
	 */
	public void SetRingtone(Context context, String ringtoneTitle) throws RingtoneDoesNotExistException;
	
	/**
	 * @return the Snooze instance of the alarm clock
	 */
	public ISnooze GetSnoozeSettings();
	
	/**
	 * Sets the snooze settings of the alarm clock
	 * @param snoozeSettings the new snooze settings to set
	 */
	public void SetSnoozeSettings(ISnooze snoozeSettings);
}
